package pers.lance.easystruct1.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import pojo.User;
import service.LoginService;

/**
 * @ Author     ：LILA3
 * @ Date       ：Created in 4:19 PM 7/24/2018
 */
@Controller
public class UserController {

    @Autowired
    LoginService loginService;

    public UserController(){
        System.out.println(UserController.class.getName());
    }

    @RequestMapping(value = "/user/login", method = RequestMethod.POST)
    @ResponseBody
    public String login(User user) {
        return loginService.login(user);
    }

    @RequestMapping(value = "/user/register", method = RequestMethod.POST)
    @ResponseBody
    public String register(User user) {
        return loginService.register(user);
    }
}
